package 私有接口方法;

public interface Calculator {
    default int add(int a, int b) {
        return a + b;
    }

    default int subtract(int a, int b) {
        return a - b;
    }

    default int multiply(int a, int b) {
        return a * b;
    }

    default int divide(int a, int b) {
        if (b == 0) {
            throw new IllegalArgumentException("Division by zero");
        }
        return a / b;
    }

    default void printOperations() {
        System.out.println("Available operations: add, subtract, multiply, divide");
        printSeparator();
    }

    private void printSeparator() {
        System.out.println("------------------------------");
    }
}

class CalculatorImpl implements Calculator {
    public static void main(String[] args) {
        CalculatorImpl calc = new CalculatorImpl();
        calc.printOperations();
        System.out.println("Add: " + calc.add(10, 5));
        System.out.println("Subtract: " + calc.subtract(10, 5));
        System.out.println("Multiply: " + calc.multiply(10, 5));
        System.out.println("Divide: " + calc.divide(10, 5));
    }
}
